import * as svgCaptcha from 'svg-captcha';

export class SvgCaptcha {
  static generateCaptcha(length: number = 4) {
    return svgCaptcha.create({
      size: length, //生成几个验证码
      fontSize: 50, //文字大小
      width: 100, //宽度
      height: 40, //高度
      background: '#ffffff', //背景颜色
    });
  }

  static generateMathCaptcha() {
    return svgCaptcha.createMathExpr({
      fontSize: 50, //文字大小
      width: 100, //宽度
      height: 40, //高度
      background: '#ffffff', //背景颜色
      mathMin: 10,
      mathMax: 20,
      mathOperator: '+-',
    });
  }
}
